Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug mousewheel_handle event & programmable mouse zoom key #629

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smonsarr
Copy link

By default jsmind zooms on mouse wheel when the CTRL key is pressed, this behaviour can be disabled but cannot be modified.

There is one bug in the current implementation : the use of the non-standard mousewheel event rather than the standard wheel event. Some browsers such as Firefox do not support mousewheel. This pull request corrects this.

The current code enables mouse wheel zooming on ctrlKey exclusively. This is a problem as many browsers use this combo in order to zoom the whole viewport and therefore capture this event without passing it down to the web page.

This proposal does two things:

  • It allows one to modify which modifier keys need to be pressed in order to activate mouse wheel zooming
  • The default key combination changed to ctrlKey + shiftKey + mousewheel

The zoom view options now allow :
/

let options = {
	view: {
		zoom: {
			min: 0.5,
			max: 2.1,
			step: 0.1,
			ctrlKey:true,
			shiftKey:true,
			altKey:false,
			metaKey:false
		}
	}
}

…programmable mouse zoom key,

(cherry picked from commit 59577a3)
Copy link
Owner

@hizzgdev hizzgdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @smonsarr , leave a comment, PTAL

@@ -31,6 +31,10 @@ const default_options = {
min: 0.5,
max: 2.1,
step: 0.1,
ctrlKey:true,
shiftKey:true,
Copy link
Owner

@hizzgdev hizzgdev Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change shiftKey to false, so it won't break any existing use case.

@hizzgdev
Copy link
Owner

Also, you may need to run npm run format to format the code, and update unit test to make npm run test-es6 success.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants